02. Setting up the Oculus SDK

Download and Set Up the Oculus app

If you haven’t already, go to Oculus Setup to download and install the Oculus app. The app works as both the Oculus storefront and software runtime, meaning it needs to be running in the background for the Oculus Rift to work.

Oculus SDK Developer Tools

Once you have the Oculus app installed, go to Oculus Downloads and get the Oculus Utilities for Unity. This package acts like the SteamVR plugin, giving you useful scripts and prefabs to more easily support the Rift.

If you are adding the Utilities package for the first time, simply download it, extract the files, and with your Unity project open double click the package file, importing all the assets.

Then go to Edit > Project Settings > Player and under “Virtual Reality SDKs” add “Oculus”.

At this point you may need to restart Unity or your computer for the SDK to be recognized.

Note: If you are updating the Oculus Utilities package rather than doing a first-time import, make sure you follow the documentation instructions and completely delete existing parts of the Oculus Utilities package.

Documentation

If you’re ever wondering how to get more out of the SDK, Oculus’s documentation is a great resource. They provide info on how to use their Unity package as well as a full developer reference.

They also provide a sample that shows examples of how to achieve certain functionality, such as using a crosshair.

Starting Development

The easiest way to get started with your Oculus support is to create an empty GameObject in your scene, then drag OVRCameraRig from the OVR prefabs folder onto the empty GameObject. OVRCameraRig can’t be moved directly, meaning that if you want the player camera to ever move you need to attach it to another GameObject.

Core Components

The OVRCameraRig script deals with all the specific tracking support.

The OVRManager script helps facilitate Oculus support and is necessary in the scene for use of OVRInput, which lets us do button handling.

Just like with SteamVR there are two controller GameObjects “LeftHandAnchor” and “RightHandAnchor” which follow the position of the hand controllers, but unlike SteamVR there is no default controller model shown.